// src/brands.js
import request from '@/utils/request'

// 分页查询品牌
export function pageBrands(params) {
    return request.get('/admin/product-brands/page', { params })
}

// 获取品牌详情
export function getBrand(id) {
    return request.get(`/admin/product-brands/${id}`)
}

// 新增品牌
export function addBrand(data) {
    return request.post('/admin/product-brands', data)
}

// 更新品牌
export function updateBrand(data) {
    return request.put('/admin/product-brands', data)
}

// 批量删除品牌
export function deleteBrands(ids) {
    return request.delete('/admin/product-brands', {
        params: { ids }
    })
}

// 修改品牌状态
export function updateBrandStatus(id, status) {
    return request.put(`/admin/product-brands/${id}/status/${status}`)
}

// 上传文件
export function uploadFile(file) {
    const form = new FormData()
    form.append('file', file)
    return request.post('/common/admin/upload', form, {
        headers: { 'Content-Type': 'multipart/form-data' }
    })
}
